package com.example.springbootdemo.lifecycle;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Configuration
@ComponentScan({"com.example.springbootdemo.lifecycle"})
public class MyConfigLifecycle {
    // 注解方式指定类内方法名
    //@Bean(initMethod = "init",destroyMethod = "detory")
    @Bean
    public Car myCar(){
        System.out.println("执行 @Bean 中方法");
        return new Car();
    }

     @Bean
    public Dog myDog(){
        System.out.println("执行 @Bean 中方法");
        return new Dog();
    }

    /*@Bean
    public MyBeanPostProcessor myBeanPostProcessor(){
        System.out.println("执行 @Bean 中方法");
        return new MyBeanPostProcessor();
    }*/

}
